(ns com.yawmark.euler.clj.e41
    (:use [com.yawmark.euler.clj.core]
          [clojure.contrib.combinatorics :only (permutations)]))

(defn euler-41-alt
  ([] (euler-41-alt "987654321"))
  ([s] (first (filter #(prime? (as-int %))
                      (lazy-cat (permutations (as-digits s))
                                [(euler-41-alt (rest s))])))))
